<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->nullable();
            $table->string('email')->nullable();
            $table->string('password')->nullable();
            $table->string('nickname')->nullable();
            $table->string('avatar_url')->nullable();
            $table->tinyInteger('sex')->default(1);
            $table->string('openid')->nullable();
            $table->string('session_id',64)->nullable();
            $table->string('xcx_openid')->nullable();
            $table->string('unionid')->nullable();
            $table->string('city')->nullable();
            $table->bigInteger('options')->default(0);
            $table->longText('json')->nullable();
            $table->rememberToken();
            $table->timestamps();

            $table->index(['xcx_openid', 'openid', 'unionid', 'options']);
            $table->index('session_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
